package com.it.a08test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test1 {
    public static void main(String[] args) {
        /*
            班里有N个学生，学生的属性：姓名，年龄，性别
            实现随机点名器
         */

        //1.定义集合
        ArrayList<String> list = new ArrayList<String>();
        //2.添加数据
        Collections.addAll(list,"范县","犯贱","肚子卷","松鹤","朱逸群");
        //随机点名
        /*Random r = new Random();
        int index = r.nextInt(list.size());
        System.out.println(list.get(index));*/

        //使用工具类Collections的打乱集合的方法
        Collections.shuffle(list);
        String name = list.get(0);
        System.out.println(name);
    }
}
